package cn.edu.zut.controller;

import cn.edu.zut.domain.Contact;
import cn.edu.zut.domain.Dep;
import cn.edu.zut.service.ContactService;
import cn.edu.zut.service.DepService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.awt.print.Book;
import java.util.List;

@Controller
@RequestMapping("/contact")
public class ContactController {
    @Autowired
    private ContactService contactService;
    @RequestMapping("/findAll.do")
    public @ResponseBody List<Contact> findAll() {
        List<Contact> list = contactService.findAll();
        return list;
    }

    @RequestMapping("/insertOne.do")
    public  @ResponseBody void insertOne(String timestamp, String senderId, String receiverId, String mas) throws Exception{
        Contact contact=new Contact(0,timestamp,senderId,receiverId,mas);
        contactService.insertOne(contact);
    }
}
